<?php
namespace app\validate\crm;

use think\Validate;

/**
 * 法务服务订单验证器
 * @package app\validate\crm
 */
class LegalServiceOrderValidate extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [
        'order_id' => 'require|integer',
        'customer_id' => 'require|integer',
        'customer_name' => 'require|max:255',
        'contact_person' => 'require|max:50',
        'contact_phone' => 'require|max:20',
        'service_fee' => 'require|float|min:0',
        'package_type' => 'require|in:1,2,3',
        'account_type' => 'require|in:1,2',
        'sub_account_owner' => 'max:255',
        'is_first_order_service' => 'in:0,1',
        'lawsuit_guidance_count' => 'integer|min:0',
        'debt_collection_count' => 'integer|min:0',
        'legal_letter_count' => 'integer|min:0',
        'contract_draft_count' => 'integer|min:0',
        'contract_review_count' => 'integer|min:0',
        'special_service_types' => 'max:255',
        'is_member' => 'require|in:0,1',
        'business_manager' => 'max:50',
        'department_manager' => 'max:50',
        'contract_manager' => 'max:50',
        'finance_manager' => 'max:50',
        'lawsuit_manager' => 'max:50',
        'lead_lawyer' => 'max:50',
    ];
    
    /**
     * 验证提示
     * @var array
     */
    protected $message = [
        'order_id.require' => '订单ID不能为空',
        'order_id.integer' => '订单ID必须为整数',
        'customer_id.require' => '客户ID不能为空',
        'customer_id.integer' => '客户ID必须为整数',
        'customer_name.require' => '客户名称不能为空',
        'customer_name.max' => '客户名称长度不能超过255个字符',
        'contact_person.require' => '联系人不能为空',
        'contact_person.max' => '联系人长度不能超过50个字符',
        'contact_phone.require' => '联系电话不能为空',
        'contact_phone.max' => '联系电话长度不能超过20个字符',
        'service_fee.require' => '服务费用不能为空',
        'service_fee.float' => '服务费用必须为数字',
        'service_fee.min' => '服务费用不能为负数',
        'package_type.require' => '套餐类型不能为空',
        'package_type.in' => '套餐类型格式错误',
        'account_type.require' => '账号类型不能为空',
        'account_type.in' => '账号类型格式错误',
        'sub_account_owner.max' => '子账号归属合同主体长度不能超过255个字符',
        'is_first_order_service.in' => '是否首单体验服务格式错误',
        'lawsuit_guidance_count.integer' => '诉讼指导数量必须为整数',
        'lawsuit_guidance_count.min' => '诉讼指导数量不能为负数',
        'debt_collection_count.integer' => '商账追款数量必须为整数',
        'debt_collection_count.min' => '商账追款数量不能为负数',
        'legal_letter_count.integer' => '法律函件数量必须为整数',
        'legal_letter_count.min' => '法律函件数量不能为负数',
        'contract_draft_count.integer' => '合同起草数量必须为整数',
        'contract_draft_count.min' => '合同起草数量不能为负数',
        'contract_review_count.integer' => '合同审查数量必须为整数',
        'contract_review_count.min' => '合同审查数量不能为负数',
        'special_service_types.max' => '专项服务类型长度不能超过255个字符',
        'is_member.require' => '是否会员不能为空',
        'is_member.in' => '是否会员格式错误',
        'business_manager.max' => '商务经理姓名长度不能超过50个字符',
        'department_manager.max' => '部门主管姓名长度不能超过50个字符',
        'contract_manager.max' => '合同管理部负责人姓名长度不能超过50个字符',
        'finance_manager.max' => '财务管理部负责人姓名长度不能超过50个字符',
        'lawsuit_manager.max' => '诉讼管理部负责人姓名长度不能超过50个字符',
        'lead_lawyer.max' => '主办律师姓名长度不能超过50个字符',
    ];
    
    /**
     * 场景定义
     * @var array
     */
    protected $scene = [
        'create' => [
            'customer_id', 'customer_name', 'contact_person', 'contact_phone',
            'service_fee', 'package_type', 'account_type', 'sub_account_owner',
            'is_first_order_service', 'lawsuit_guidance_count', 'debt_collection_count',
            'legal_letter_count', 'contract_draft_count', 'contract_review_count',
            'special_service_types', 'is_member', 'business_manager', 'department_manager',
            'contract_manager', 'finance_manager', 'lawsuit_manager', 'lead_lawyer'
        ],
        'update' => [
            'order_id', 'customer_id', 'customer_name', 'contact_person', 'contact_phone',
            'service_fee', 'package_type', 'account_type', 'sub_account_owner',
            'is_first_order_service', 'lawsuit_guidance_count', 'debt_collection_count',
            'legal_letter_count', 'contract_draft_count', 'contract_review_count',
            'special_service_types', 'is_member', 'business_manager', 'department_manager',
            'contract_manager', 'finance_manager', 'lawsuit_manager', 'lead_lawyer'
        ],
    ];
}